# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=phemail
pkgver=28.302b24d
pkgrel=3
groups=('blackarch' 'blackarch-social' 'blackarch-automation')
pkgdesc='A python open source phishing email tool that automates the process of sending phishing emails as part of a social engineering test.'
arch=('any')
url='https://github.com/Dionach/PhEmail'
license=('GPL3')
depends=('python2' 'python2-beautifulsoup4' 'python2-dnspython')
makedepends=('git')
source=("$pkgname::git+https://github.com/Dionach/PhEmail.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md CHANGELOG.txt \
    DISCLAIMER.txt TODO.txt
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md CHANGELOG.txt TODO.txt DISCLAIMER.txt LICENSE.txt

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

